package com.foreveross.fetl.vo;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.foreveross.fetl.vo.single.SinglePlaneInfoVO;



public class OfficalChannelPlusTop5 implements
		Comparable<OfficalChannelPlusTop5> {

	private Logger log = LoggerFactory
			.getLogger(OfficalChannelPlusTop5.class);
	private SinglePlaneInfoVO homePlaneInfo;
	private String homeRowkey;
	private String channelRowkey;

	private SinglePlaneInfoVO channelPlaneInfo;

	

	public String getHomeRowkey() {
		return homeRowkey;
	}

	public void setHomeRowkey(String homeRowkey) {
		this.homeRowkey = homeRowkey;
	}

	public String getChannelRowkey() {
		return channelRowkey;
	}

	public void setChannelRowkey(String channelRowkey) {
		this.channelRowkey = channelRowkey;
	}
	

	public SinglePlaneInfoVO getHomePlaneInfo() {
		return homePlaneInfo;
	}

	public void setHomePlaneInfo(SinglePlaneInfoVO homePlaneInfo) {
		this.homePlaneInfo = homePlaneInfo;
	}

	public SinglePlaneInfoVO getChannelPlaneInfo() {
		return channelPlaneInfo;
	}

	public void setChannelPlaneInfo(SinglePlaneInfoVO channelPlaneInfo) {
		this.channelPlaneInfo = channelPlaneInfo;
	}

	public int compareTo(OfficalChannelPlusTop5 o) {
		 //Float 排序默认为从小到大排列，因此添加了负号
		 Double thissPrice = 0d;
		 Double otherPrice  = 0d;
		try{
			thissPrice = - getChannelPlaneInfo().getTotalLowestPrice() / getHomePlaneInfo().getTotalLowestPrice() ;
		}catch(Exception e){
			log.error("OfficalChannelPlusTop5 this最小值解析出错,homeRowkey:["+homeRowkey+"],channelRowkey["+ channelRowkey+"]");
			e.printStackTrace();
		}
		try{
		otherPrice = - o.getChannelPlaneInfo().getTotalLowestPrice() / o.getHomePlaneInfo().getTotalLowestPrice() ;
		}catch(Exception e){
			log.error("OfficalChannelPlusTop5 other最小值解析出错,homeRowkey:["+o.getHomeRowkey()+"],channelRowkey["+ o.getChannelRowkey()+"]");
			//e.printStackTrace();
		}
		return thissPrice.compareTo(otherPrice);
	}

}
